/*
*******************************************************************************
* ansi c source code
* file name:
*	Freq_Comp.c
* abstract:
*	to compensate the freqency offset
* author:Fangming He
*******************************************************************************
*/
/*
*******************************************************************************
*                               include files
*******************************************************************************
*/
#include <math.h>
#include <stdio.h>
#include "../common/globaldef.h"
#include "../common/bit_rev.h"
#include "../common/globalVai.h"

/*
*******************************************************************************
*                            function definition
*******************************************************************************
*/
/*
******************************************************************************* 
* description:
*	to compensate the freqency offset
* input:
*   Offset_Esti : the frequency offset being estimated  
*	*Symbol : the address of OFDM symbol
* output:
*   none
* Referenced;
* author:
*	guo liang       2006-05-30
*******************************************************************************
*/

int Freq_Comp(double Offset_Esti ,struct Complex *Symbol)
{
	struct Complex alpha;
	int i;
	for ( i = 96; i < (FFT_Size+CP_Length); i++)
	{
		alpha.real = cos ( 2 * PI * Offset_Esti * i / FFT_Size );
	    alpha.imag = -sin ( 2 * PI * Offset_Esti * i / FFT_Size );
		Symbol[i] = Mul_complex( alpha , Symbol[i] );
	}
	return 1;
}
